package com.ruoyi.content.service.impl;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.content.domain.Articles;
import com.ruoyi.content.mapper.ArticlesMapper;
import com.ruoyi.content.service.IArticlesService;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class ArticlesServiceImpl implements IArticlesService {

    @Autowired
    private ArticlesMapper articlesMapper;

    @Override
    public Articles selectArticleById(Long articleId) {
        return articlesMapper.selectArticleById(articleId);
    }

    @Override
    @Transactional
    public List<Articles> selectArticleList() {
        return articlesMapper.selectArticleList();
    }

    @Override
    public int insertArticle(Articles articles) {
        return articlesMapper.insertArticle(articles);
    }

    @Override
    public int updateArticle(Articles articles) {
        return articlesMapper.updateArticle(articles);
    }

    @Override
    public int deleteArticleById(Long articleId) {
        return articlesMapper.deleteArticleById(articleId);
    }
}